﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Medical.Entity;
using Medical.Business;
using System.Data;

/// <summary>
/// 专题页面
/// </summary>
public partial class Topic : WebPage
{
    protected DataTable dtArticle = null;
    protected int nCount = 1;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataRow[] drList = Until.GetSEO().Select("Type=6");
            if (drList.Length > 0)
                SetPageInfo(drList[0]["PageTitle"].ToString() == string.Empty ? ("热点专题_" + strWebTitle) : drList[0]["PageTitle"].ToString(), drList[0]["PageKeywords"].ToString(), drList[0]["PageDescription"].ToString());
            InitData();
        }
    }

     /// <summary>
    /// 数据初始化
    /// </summary>
    protected void InitData()
    {
        dtArticle = new BisArticle().GetAllArticle(ArticelTypeEnum.Subject);
        dtArticle.Columns.Add("url", typeof(System.String));
        if (dtArticle.Rows.Count > 0)
        {
            string strIDList = string.Empty;
            foreach (DataRow dr in dtArticle.Rows)
            {
                strIDList += (strIDList == string.Empty ? "" : ",") + dr["ID"].ToString();
            }
            DataTable dtMeta = new BisArticleMetaValue().GetList(ArticelTypeEnum.Subject, strIDList);
            foreach (DataRow dr in dtArticle.Rows)
            {
                foreach (DataRow drMeta in dtMeta.Rows)
                {
                    if (Convert.ToInt32(dr["ID"]) == Convert.ToInt32(drMeta["ArticleID"]))
                        dr["url"] = drMeta["MetaValue"];
                }
            }
        }
        rptTopic.DataSource = dtArticle;
        rptTopic.DataBind();

        
    }
}